package TAIC.text;

import java.io.File;
import java.io.PrintStream;
import java.util.Scanner;

import TAIC.test.ParaReader;

public class CorpusGen {

	public static void main(String[] args) {
		if ( args.length < 2 ) {
			System.out.println( "please input the config file and the offset") ;
			return ;
		}
		int offset = Integer.valueOf( args[ 1 ]) ;
		ParaReader para = new ParaReader ( args [ 0 ]) ;
		try {
			PrintStream fout = new PrintStream ( new File ( "corpus.txt")) ; 
			for ( int i = 0 ;i < para.getParaInt( "classes") ; i ++ ) {
				String dir = para.getParaStr("auxilary_" + i ) ;
				Scanner scanner = new Scanner ( new File ( dir + "index.txt")) ;
				while ( scanner.hasNext() ) {
//					int classname = scanner.nextInt() ;
					String filename= scanner.nextLine().trim() ;
					fout.println ( (i+ offset) + " " + dir + filename ) ;
				}
			}
			fout.close () ; 
		}catch ( Exception e ) {
			e.printStackTrace() ; 
		}
	}
}
